<template>
	<div class="person">
		<h1>中国</h1>
		<h2 ref="title2">北京</h2>
		<h2>天安门</h2>
		<button @click="outFun">输出</button>
	</div>
</template>
<script lang="ts" setup>
import { ref,defineExpose } from 'vue'

//创建一个title2，用于存储ref标记的内容
let title2 = ref()
let a = ref(0)
let b = ref(1)
let c = ref(3)

function outFun(){
	console.log(title2.value);
}

//设置向父级暴露哪些数据
defineExpose({a, b})
</script>
<style>
.person {
	padding: 10px;
}
</style>
